题目地址 (opens new window)
解题代码
public class Solution { public int[] maxDepthAfterSplit(String seq) { int[] ans = new int [seq.length()]; int idx = 0; for(char c: seq.toCharArray()) { ans[idx++] = c == '(' ? idx & 1 : ((idx + 1) & 1); } return ans; } }
← LeetCode 最长重复子数组 LeetCode 有效的字母异位词 →